package com.suiwei.webservice.base.wsClient.client;

import com.suiwei.webservice.base.wsClient.autoGeneration.GreetWebService_Service;import com.suiwei.webservice.base.wsClient.autoGeneration.GreetWebService;

/**
 * 根据自动生成的代码，写的客户端，没有账号密码验证
 */
public class HelloWorldClient {

    public static void main(String[] argv) {
        //实现basic鉴权，可以添加以下代码进行授权
//        Bus bus = BusFactory.getThreadDefaultBus();
//        bus.setExtension((name, address, httpConduit) -> {
//            final AuthorizationPolicy authorization = new AuthorizationPolicy();
//            authorization.setUserName("username");
//            authorization.setPassword("password");
//            httpConduit.setAuthorization(authorization);
//            // final HttpAuthSupplier supplier = new DefaultBasicAuthSupplier();
//            // httpConduit.setAuthSupplier(supplier);
//        }, HTTPConduitConfigurer.class);

        GreetWebService_Service greetWebServiceService = new GreetWebService_Service();
        GreetWebService webService = greetWebServiceService.getGreetWebServiceImplPort();
        String result = webService.greeting("张三");
        System.out.println("result = " + result);
    }
}